import {Component, Injector,AfterViewInit} from '@angular/core';
import {NzMenuModule} from "ng-zorro-antd/menu";
import {AutoRule} from "./model/auto-rule";
import {ExecActionInterface} from "./plugin/exec-action-interface";
import {ExecActionMainService} from "./plugin/exec-action-main.service";
import { FlatTreeControl } from '@angular/cdk/tree';

import { NzTreeFlatDataSource, NzTreeFlattener } from 'ng-zorro-antd/tree-view';
import {RuleExpression} from "./model/rule-expression";
import {NzFormatEmitEvent, NzTreeNode, NzTreeNodeOptions} from "ng-zorro-antd/tree";
import {NzContextMenuService, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown";
import {RuleExecService} from "./service/rule-exec.service";
import {SystemUtilsService} from "./service/system-utils.service";
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  // activated node
  testPath="C:\\Users\\xuejike\\Pictures\\f6009216.jpg"
  nodes :RuleExpression[] =[{
    "action": "match",
    "expression": {
      "matchItem":"ext",
      "matchWhere":"in",
      "matchValue":".png,.jpg,.jpeg,.gif"
    },
    "children": [
      {
        "action": "imgExif",
        "expression": {},
        "children": [
          {
            "action": "match",
            "expression": {
              "matchItem":"name",
              "matchWhere":"in",
              "matchValue":".png,.jpg,.jpeg,.gif"
            }
          }
        ]
      }
    ]
  }
  ]


  constructor(protected ruleExec:RuleExecService,public system:SystemUtilsService) {

  }

  public async exec(){
    let fileInfo = this.ruleExec.createFileInfo(this.testPath);
    this.ruleExec.execRule(fileInfo,null,this.nodes)
  }


}

